package cn.zhl.algorithm._1_排序;

/**
 * @program: demos
 * @description:
 * @author: 刘振华
 * @create: 2020-05-27 12:52
 **/
public class SelectionSort extends Sort {
	@Override
	protected void sort() {
		for(int i = array.length-1;i > 0;i--){
			int maxIndex = 0;
			for(int j = 1;j <= i;j++){
				if(compare(maxIndex,j)<=0){
					maxIndex = j;
				}
			}
			swap(i,maxIndex);
		}
	}
}
